﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Devonline.Entity;

namespace Web.Models
{
    /// <summary>
    /// 订单表
    /// </summary>
    [Table("order")]
    public class Order : EntitySetWithCreate
    {
        public Order()
        {
            OrderDetails = new HashSet<OrderDetail>();
        }

        /// <summary>
        /// 总价
        /// </summary>
        [Column("amount", TypeName = "DECIMAL(8,2)"), DisplayName("总价")]
        public decimal Amount { get; set; }
        /// <summary>
        /// 客户名
        /// </summary>
        [Column("customer"), DisplayName("客户名"), Required, MaxLength(64)]
        public string Customer { get; set; }
        /// <summary>
        /// 下单时间
        /// </summary>
        [Column("order_time"), DisplayName("下单时间")]
        public DateTime OrderTime { get; set; }

        /// <summary>
        /// 订单明细
        /// </summary>
        public virtual ICollection<OrderDetail> OrderDetails { get; set; }
    }
}
